﻿using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PocketDOHS
{
    public partial class AvalArtTemp : Form
    {
        private TextBox txtFocus;        

        public AvalArtTemp()
        {
            InitializeComponent();
        }

        private void btnGravar_Click(object sender, EventArgs e)
        {
            if ((txtSint.Text != "") && (txtSens.Text != "") && (txtMob.Text != "") && (txtEst.Text != ""))
            {
                Dados.Guia.AvaliacaoClinica.AvalArtTemporo.Sintomas.atb_Sintomas = txtSint.Text;
                Dados.Guia.AvaliacaoClinica.AvalArtTemporo.Sintomas.Estalido = txtEst.Text;
                Dados.Guia.AvaliacaoClinica.AvalArtTemporo.Sintomas.SensibilPalpacao = txtSens.Text;
                Dados.Guia.AvaliacaoClinica.AvalArtTemporo.Sintomas.MobMandReduz = txtMob.Text;
                FormsMethods.nextForm();
            }
            else
                MessageBox.Show("Preencha os Campos Corretamente...", "ATENÇÃO!!");
        }
    
 
        private void btnVoltar_Click(object sender, EventArgs e)
        {
            FormsMethods.prevForm();
        }

        private void AvalArtTemp_Activated(object sender, EventArgs e)
        {
            if (FormsMethods.Inicializa.ToArray()[FormsMethods.VetIndex])
            {
                Limpar_txt_Form();
                FormsMethods.Inicializa[FormsMethods.VetIndex] = false;
                txtSint.Focus();
            }
            if (FormsMethods.Altera.ToArray()[FormsMethods.VetIndex])
            {
                FormsMethods.preencheForms();
                FormsMethods.Altera[FormsMethods.VetIndex] = false;
            }
        }

        private void Limpar_txt_Form()
        {
            txtSint.Text = "";
            txtSens.Text = "";
            txtMob.Text = "";
            txtEst.Text = "";
        }

        #region Changed       

            private void txtSint_TextChanged(object sender, EventArgs e)
            {
                if ((txtSint.Text == "0") || (txtSint.Text == "9"))
                {
                    txtEst.Text = "";
                    txtMob.Text = "";
                    txtSens.Text = "";

                    btn1.Enabled = false;

                    btnGravar.Focus();
                }
                else
                {
                    txtEst.Enabled = true;
                    txtMob.Enabled = true;
                    txtSens.Enabled = true;

                    txtEst.Focus();
                }
            }

            public void WritetxtExam(object sender, EventArgs e)
            {
                FormsMethods.WriteTextBox((Button)sender, txtFocus, this);
            }

            private void txtSint_GotFocus(object sender, EventArgs e)
            {
                txtFocus = (TextBox)sender;

                btn1.Enabled = true;
            }

            public void TxtGotFocus(object sender, EventArgs e)
            {
                txtFocus = (TextBox)sender;
            }

        #endregion

    }
}